package com.swq.java.code.chapter06.code11;

import java.util.HashSet;
import java.util.Set;

public class IntSet {
    private Set<Integer> set;

    public IntSet(Set<Integer> set) {
        this.set = set;
    }

    public boolean add(int a) {
        return set.add(Integer.valueOf(a));  //调用Set的add(Object o)方法
    }

    public boolean remove(int a) {
        return set.remove(Integer.valueOf(a));  //调用Set的remove(Object o)方法
    }

    public boolean add(Integer o) {
        return set.add(o);
    }

    public boolean remove(Integer o) {
        return set.remove(o);
    }

    public static void main(String[] args) {
        int a = 1;
        Integer b = 2;
        Set<Integer> set = new HashSet<>();
        IntSet intSet = new IntSet(set);
        intSet.add(a);
        intSet.add(b);
        System.out.println(intSet.set.size());
    }
}